package com.ruoyi.pack.domain;

import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 定位器对象 pack_locator
 * 
 * @author ruoyi
 * @date 2024-01-01
 */
public class PackLocator extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 定位器ID */
    private Long locatorId;

    /** 定位器编码 */
    @Excel(name = "定位器编码")
    private String locatorCode;

    /** 绑定的器具ID */
    @Excel(name = "绑定的器具ID")
    private Long containerId;

    /** 绑定的器具编码（冗余字段，方便查询） */
    private String containerCode;
    
    /** 绑定的器具类型编码（冗余字段，方便查询） */
    private String materialCode;

    /** 设备型号 */
    @Excel(name = "设备型号")
    private String deviceModel;

    /** 生产日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date manufactureDate;

    /** 电池电量（百分比） */
    private Long batteryLevel;

    /** 信号强度 */
    private Long signalStrength;

    /** 定位器状态（1-正常 2-离线 3-故障 4-停用） */
    @Excel(name = "定位器状态", readConverterExp = "1=正常,2=离线,3=故障,4=停用")
    private String locatorStatus;

    /** 最后在线时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastOnlineTime;
    
    /** 绑定的器具信息 */
    private PackContainer boundContainer;

    public void setLocatorId(Long locatorId) 
    {
        this.locatorId = locatorId;
    }

    public Long getLocatorId() 
    {
        return locatorId;
    }
    public void setLocatorCode(String locatorCode) 
    {
        this.locatorCode = locatorCode;
    }

    public String getLocatorCode() 
    {
        return locatorCode;
    }
    
    public Long getContainerId() 
    {
        return containerId;
    }

    public void setContainerId(Long containerId) 
    {
        this.containerId = containerId;
    }
    
    public String getContainerCode() 
    {
        return containerCode;
    }

    public void setContainerCode(String containerCode) 
    {
        this.containerCode = containerCode;
    }
    
    public String getMaterialCode() 
    {
        return materialCode;
    }

    public void setMaterialCode(String materialCode) 
    {
        this.materialCode = materialCode;
    }
    
    public void setDeviceModel(String deviceModel) 
    {
        this.deviceModel = deviceModel;
    }

    public String getDeviceModel() 
    {
        return deviceModel;
    }
    public void setManufactureDate(Date manufactureDate) 
    {
        this.manufactureDate = manufactureDate;
    }

    public Date getManufactureDate() 
    {
        return manufactureDate;
    }
    public void setBatteryLevel(Long batteryLevel) 
    {
        this.batteryLevel = batteryLevel;
    }

    public Long getBatteryLevel() 
    {
        return batteryLevel;
    }
    public void setSignalStrength(Long signalStrength) 
    {
        this.signalStrength = signalStrength;
    }

    public Long getSignalStrength() 
    {
        return signalStrength;
    }
    public void setLocatorStatus(String locatorStatus) 
    {
        this.locatorStatus = locatorStatus;
    }

    public String getLocatorStatus() 
    {
        return locatorStatus;
    }
    public void setLastOnlineTime(Date lastOnlineTime) 
    {
        this.lastOnlineTime = lastOnlineTime;
    }

    public Date getLastOnlineTime() 
    {
        return lastOnlineTime;
    }
    
    public PackContainer getBoundContainer() 
    {
        return boundContainer;
    }

    public void setBoundContainer(PackContainer boundContainer) 
    {
        this.boundContainer = boundContainer;
    }
    
    /**
     * 获取绑定状态
     * @return bound-已绑定, unbound-未绑定
     */
    public String getBindStatus() 
    {
        return containerId != null ? "bound" : "unbound";
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("locatorId", getLocatorId())
            .append("locatorCode", getLocatorCode())
            .append("containerId", getContainerId())
            .append("deviceModel", getDeviceModel())
            .append("manufactureDate", getManufactureDate())
            .append("batteryLevel", getBatteryLevel())
            .append("signalStrength", getSignalStrength())
            .append("locatorStatus", getLocatorStatus())
            .append("lastOnlineTime", getLastOnlineTime())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .toString();
    }
} 